home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software 2000
/
Software 2000 Volume 1 (Disc 1 of 2).iso
/
education
/
e121.dms
/
e121.adf
/
Source.AMOS
/
Source.amosSourceCode
< prev
Wrap
AMOS Source Code
|
1993-01-09
|
26KB
|
1,137 lines
A#=0.0
Auto View Off
Request On
On Error Proc CORRECT
Get Fonts
Dim PUZZLE(320),VFLIP(320),HFLIP(320)
Global P,PUZZLE(),VFLIP(),HFLIP(),Z,X,X1,Y,Y1,TILES,TILES$,XTILES,YTILES,XPIX,YPIX
Global GRAB,PIC,SPACEBAR,LOC1,MKEY,MOVES,MUZAK,MUZAKCHANGE,TIME,AHEAD,VERT,HORIZ,WIN,PIC$,OLD
Global WHOLEMIN,SEC,HOUR,MUSBANK,PCOUNTER,PCOUNT,TIME$,PICTICK,ERR,RES,GO
Global FINSEC,FINWHOLEMIN,FINHOUR,TTIME,OLDTTIME
Proc SETUP
Rem ********* TOP OF OUTER LOOP *************
TIPPYTOP:
F=Free
GRAB=0
ERR=0
HORIZ=HORIZ*-1
VERT=VERT*-1
TIME=TIME-1
OLD=OLD*-1
PCOUNTER=PCOUNTER-1
MUZAK=MUZAK*-1
MUZAKCHANGE=MUZAKCHANGE*-1
WIN=0
MOVES=0
SEC=0 : WHOLEMIN=0 : HOUR=0
AHEAD=1
Proc FIRSTSCREEN
OLDSTART:
Proc PICLOAD
If ERR=1 Then Goto TIPPYTOP
Change Mouse 3
Show On
If OLD=-1 Then Proc PRESHUFFLE
If OLD=1 Then OLD=-1
Proc DEFZONES
Proc CUTUP_PIC
Cls 0
Proc SHUFFLE
Double Buffer
Autoback 0
Bob Update Off
Screen Show 2
Screen To Front 2
If MUZAK=-1 Then Bell 60
Change Mouse 2
Every 50 Proc CLOCK
Rem ********************* Main Loop
Repeat
If Key State(76)=True and Y Hard(2,0)>=29 Then Proc MOVE_SCREEN[2,,-2]
If Key State(77)=True and Y Hard(2,0)<=297 Then Proc MOVE_SCREEN[2,,2]
If Key State(95) Then Proc SEEPIC
If Key State(84) Then Proc PICDO : Goto TIPPYTOP
If Key State(89) Then Proc ILLBEBACK
If Key State(69) Then Proc WHICHKEYS
If Key State(55) Then Proc MUZAKMENU
If Key State(80)=True Then Proc FINISH : Goto TIPPYTOP
If OLD=1 Then Goto OLDSTART
Screen Swap : Wait Vbl
Bob Clear
If Mouse Click>0
MKEY=Mouse Key
If GRAB=1
If Key State(64) and MKEY=1
SPACEBAR=1
End If
End If
If GRAB=0
Inc MOVES
Proc GRABTILE
Else Proc TILEPASTE
End If
End If
Bob Draw
Screen Swap : Wait Vbl
Bob Clear
Screen Copy Physic To Logic
Bob Draw
Until WIN>0
If WIN=1
If TIME=0 and TTIME<=0
Proc OUTOFTIME
Else
Proc FINISH
End If
End If
Goto TIPPYTOP
Rem ******************** end of main loop
End
Procedure PRESHUFFLE
Randomize Timer
For A=1 To TILES : PUZZLE(A)=0 : VFLIP(A)=0 : HFLIP(A)=0 : Next
For A=1 To TILES
RETRY:
Q=Rnd(TILES-1)+1
If PUZZLE(Q)=0 Then PUZZLE(Q)=A Else Goto RETRY
F=Rnd(1)+1 : If VERT=1 and F>1 Then VFLIP(Q)=-1 Else VFLIP(Q)=1
F=Rnd(1)+1 : If HORIZ=1 and F>1 Then HFLIP(Q)=-1 Else HFLIP(Q)=1
Next A
End Proc
Procedure DEFZONES
Screen 0
Reserve Zone
Reserve Zone TILES+1
P=0
For C=0 To YTILES-1
For B=0 To XTILES-1
Inc P
Set Zone P,B*XPIX,C*YPIX To XPIX+(B*XPIX),YPIX+(C*YPIX)
Next
Next
End Proc
Procedure CUTUP_PIC
P=0
For C=0 To YTILES-1
For B=0 To XTILES-1
Inc P
Screen 1
Get Block P,B*XPIX,C*YPIX,XPIX,YPIX
Next
Next
End Proc
Procedure SHUFFLE
Rem display completed tiles
Screen Hide 1
Screen 1
Cls 0
P=0
For C=0 To YTILES-1
For B=0 To XTILES-1
Inc P
Put Block P,B*XPIX,C*YPIX
Next
Next
Wait 321-TILES
Rem display shuffled tiles
Screen To Front 0
Screen 0
P=0
For C=0 To YTILES-1
For B=0 To XTILES-1
Inc P
If VFLIP(P)=-1
Vrev Block PUZZLE(P)
End If
If HFLIP(P)=-1
Hrev Block PUZZLE(P)
End If
Put Block PUZZLE(P),B*XPIX,C*YPIX
Next
Next
Screen 0
Limit Mouse X Hard(2),Y Hard(1) To X Hard((320*RES)-2),Y Hard(255)
Screen Show 1
End Proc
Procedure GRABTILE
If MKEY=1
Inc GRAB
LOC1=Mouse Zone
Y=Int(Y Screen(Y Mouse)) : X=(X Screen(X Mouse))
X1=Int(X/XPIX)*XPIX
Y1=Int(Y/YPIX)*YPIX
Get Bob 6,X1,Y1 To XPIX+X1,YPIX+Y1
No Mask 6
Hot Spot 6,$11
Channel 6 To Bob 6
Bob 6,X,Y,6
A$=A$+"Update:Let X=XS(0,XM);Let Y=YS(0,YM);Pause;Jump Update"
Amal 6,A$
Amal On
End If
MKEY=0
End Proc
Procedure TILEPASTE
X2=X1 : Y2=Y1
LOC2=Mouse Zone
Swap PUZZLE(LOC1),PUZZLE(LOC2)
Swap VFLIP(LOC1),VFLIP(LOC2)
Swap HFLIP(LOC1),HFLIP(LOC2)
Y=Int(Y Screen(Y Mouse)) : X=(X Screen(X Mouse))
X1=Int(X/XPIX)*XPIX
Y1=Int(Y/YPIX)*YPIX
Bob Clear
Get Bob 7,X1,Y1 To XPIX+X1,YPIX+Y1
No Mask 7
Paste Bob X2,Y2,7
If MKEY=2 and VERT=1 Then VFLIP(LOC2)=VFLIP(LOC2)*-1 : Vrev Block PUZZLE(LOC2) : IMAGE=IMAGE+$4000
If SPACEBAR=1 and MKEY=1 and HORIZ=1 Then HFLIP(LOC2)=HFLIP(LOC2)*-1 : Hrev Block PUZZLE(LOC2) : SPACEBAR=0 : IMAGE=IMAGE+$8000
Paste Bob X1,Y1,IMAGE+6
Bob Off
Amal Freeze
GRAB=0 : MKEY=0
Proc CHECK_FINISH
End Proc
Procedure SEEPIC
Inc PIC
Hide On
If PIC>1
PIC=0 : Show On
End If
If PCOUNT>0
Screen To Front PIC
If PIC=0
Screen To Front 2
End If
Else
Screen 1 : Colour 0,$0 : Cls 0
Colour 2,$FFF
Ink 2,0
Set Font 3
Gr Writing 1
C$="SORRY!"
If RES=1
Text 118*RES,110,C$
End If
If RES=2
Text 142*RES,110,C$
End If
Set Font 1
Gr Writing 0
Screen To Front PIC
End If
If PIC=0 Then Dec PCOUNT
STILLPRESSED:
If Key State(95)=True Then Goto STILLPRESSED
End Proc
Procedure MOVE_SCREEN[S,DX,DY]
Rem get hardware coordinates of top left corner of screen s
Rem x coordinate
SX=X Hard(S,0)
Rem if sx goes weird, reset to default position
If SX<112 Then SX=128
Rem get y coordinate
SY=Y Hard(S,0)
Rem if y hard gives a strange result, reset to 50
If SY<0 Then SY=50
Rem move screen to new position
Screen Display S,SX+DX,SY+DY,,
DY=0
End Proc
Procedure PICDO
Every Off
Hide On
WIN=2
Bob Clear
Screen Copy 0 To 1
Screen 1
Screen To Front 1
For A=1 To TILES
Q=PUZZLE(A)
If VFLIP(A)=-1 Then Vrev Block PUZZLE(A)
If HFLIP(A)=-1 Then Hrev Block PUZZLE(A)
YPOS=Int(Q-1)/XTILES
XPOS=Int(Q-1) mod XTILES
Put Block PUZZLE(A),XPOS*XPIX,YPOS*YPIX
For N=1 To 350 : Next
Next
Screen 0
Cls 0
Screen Swap : Wait Vbl
Cls 0
Screen Swap : Wait Vbl
Screen 2
Cls 0
Flash 0,"(f00,50)(aa0,50)"
Pen 3 : Paper 0
Locate 15,0
Print "Hard luck! Why not try again on an easier level?";
Screen To Front 2
If MUZAK=-1
For W=9 To 1 Step -1
Bell W
Wait 4
Next
End If
Do
If Mouse Click=1 Then Exit
Screen 1
Loop
Screen 0
Screen Close 2
Fade 1 : Wait 16
Clear Key
End Proc
Procedure PICLOAD
On Error Proc CORRECT
Proc MUZAKPLAY
If OLD=1
Proc FILELOAD
End If
HEREUARE:
Screen Open 3,640,256,2,Hires
Curs Off
Proc MOVE_SCREEN[3,0,-4]
Set Rainbow 0,1,280,"","","(9,1,15)(9,-1,15)"
Rainbow 0,0,40,280
PICK_A_PIC:
Inc PICTICK
If PICTICK=1
PIC$="called "+PIC$
End If
If OLD=1
PIC$=PIC$
Else PIC$=""
End If
Clear Key
' Dir$="sys:Pictures/"
F$=Fsel$("Sys:Pictures/","","Pick a Picture for your puzzle",PIC$)
If F$=""
OLD=-1 : ERR=1 : Pop Proc
End If
If Exist(F$)=False
Goto PICK_A_PIC
End If
If OLD=1
T=Instr(PIC$,F$)
If T=0
Goto PICK_A_PIC
End If
End If
Rainbow Del 0
Wait 1
Palette $0,$FFF
Cls 0
Pen 1 : Paper 0
Locate 32,15
Print "Loading picture..."
Load Iff F$,1
If Screen<>1
Bell 40
Cls
Locate 28,15
Print "Unable to load picture"
Locate 15,17
Print "Press left mouse key to load a different picture"
Do
If Mouse Key=1
Exit
End If
Loop
Goto HEREUARE
End If
Screen Hide 1
Hide On
Proc MOVE_SCREEN[1,0,-4]
PICTICK=0
Screen Close 3
Proc SIZE
PIC$=F$
W=Screen Width
COUL=Screen Colour
If W>430
W=640
Screen Open 0,W,256,COUL,Hires
End If
If W<=430
W=320
Screen Open 0,W,256,COUL,Lowres
End If
Limit Mouse X Hard(2),Y Hard(1) To X Hard((320*RES)-2),Y Hard(255)
Curs Off
Screen Hide 0
Proc MOVE_SCREEN[0,0,-4]
If PCOUNTER<>0 Then Screen Copy 1 To 0
Get Palette 1
Flash Off
Colour Back 0
Screen Open 2,640,8,4,Hires
Screen Hide 2
Proc MOVE_SCREEN[2,0,246]
Flash Off
Colour 0,$337 : Colour 1,$B00 : Colour 3,$FF0
Curs Off
Cls 0
Paper 0
If VERT=-1 Then VFLIP$="V Flip: Off" Else VFLIP$="V Flip: On"
If HORIZ=-1 Then HFLIP$="H Flip: Off" Else HFLIP$="H Flip: On"
Locate 0,0
If TIME=0
WIN=-1
Inc TTIME
Print "Time Left ";
Proc CLOCK
WIN=0
End If
If TIME=1 Then Print "Time Taken 00:00:00";
If TIME=2 Then Print "Clock Time ";
Screen 2
Locate 24,0 : Print "Move No. 0";
If PCOUNT>-1 and PCOUNT<6
Locate 38,0
Pen 3
Print PCOUNT;
Pen 2
End If
Locate 43,0
Print TILES;" Tiles";
Locate 54,0 : Print HFLIP$;
Locate 68,0 : Print VFLIP$;
Screen Show 1
Screen Show 0
Screen 0
Limit Mouse X Hard(2),Y Hard(1) To X Hard((320*RES)-2),Y Hard(255)
End Proc
Procedure SETUP
Erase 7
HORIZ=-1
VERT=-1
OLD=-1
TIME=-1
PCOUNTER=-1
MUZAK=-1
MUZAKCHANGE=1
TILES=40
TILES$=" 40"
Change Mouse 2
Curs Off : Flash Off
End Proc
Procedure CHECK_FINISH
For A=1 To TILES
If PUZZLE(A)=A and VFLIP(A)=1 and HFLIP(A)=1 Then Inc CHECK
Next
If CHECK=TILES Then WIN=1
End Proc
Procedure FINISH
Every Off
Bob Clear
Hide On
If MUZAK=1 Then Track Stop
Screen 2
Cls 0
Flash 0,"(f00,50)(aa0,50)"
Pen 3
If TIME=1
Locate 8,0
Print "Time Taken ";TIME$;
End If
Locate 31,0
Print "PICTURE COMPLETED";
Locate 50,0
If MOVES=1
Print "in";Str$(MOVES);" Move";
Else
Print "in";Str$(MOVES);" Moves";
End If
Wait 15
Music 1
Wait 300
Music Off
Screen Close 1
STILLPRESSED:
If Key State(80)=True Then Goto STILLPRESSED
Do
If Mouse Click=1 Then Exit
Loop
If MUZAK=1 Then Track Play
Screen Close 2
Fade 1 : Wait 16
Screen Close 0
WIN=1
Clear Key
End Proc
Procedure FIRSTSCREEN
Clear Key
Screen Open 0,640,256,16,Hires
Screen Hide 0
Curs Off
Screen Open 1,320,200,32,Lowres
Screen Hide 1
Proc MOVE_SCREEN[1,0,-4]
Unpack 8 To 1
Auto View On
Hide On
Change Mouse 2
Screen 0
Colour 4,$C00 : Colour 5,$292 : Colour 3,$E70
Curs Off
Flash Off
Set Rainbow 0,1,280,"","","(9,1,15)(9,-1,15)"
Rainbow 0,0,38,280
Limit Mouse 140,60 To 440,280
X Mouse=200 : Y Mouse=100
Ink 5
Set Font 3
T$="PICTURE PUZZLE - OPTIONS"
Text 165,39,T$
Set Font 1
Ink 2
HERE:
Reserve Zone 9
Z=0
Restore L
For N=1 To 8
Inc Z
If Z>4 Then M=320 Else M=Z
Read M$
Gr Writing 0
If Z>4
Set Zone Z,M+215,((Z-4)*32)+32 To M+254,56+((Z-4)*32)
X=50*8 : Y=46+((Z-4)*4*8)
Else
Set Zone Z,M+214,(Z*32)+32 To M+253,56+(Z*32)
X=40 : Y=46+(Z*32)
End If
Text X,Y,M$
Paper 4
If Z=1 Then TILES$=TILES$ : TILES=Val(TILES$)
Proc BUTTONPRINT
Next
L: Data "PUZZLE PIECES","HORIZONTAL FLIPS","VERTICAL FLIPS","LOAD SAVED PUZZLE","STOPWATCH","MUSIC ","CHANGE MUSIC","PICTURE COUNTER"
Paper 0
Z=9
Proc BUTTONPRINT
Set Zone 9,296,(224)-8 To 376,16+(224)
If GO=0
Music 1 : Wait 230
GO=1
Else
Do
If Mouse Key=1
Exit
End If
Loop
End If
Screen 1
Fade 1 : Wait 15
Screen Show 0
Show On
Screen 0
Screen To Front 0
Screen Close 1
If GO=1 Then Wait 20 : Music Off
HERE1:
Do
If Mouse Click=1 and Mouse Zone>0 Then Exit
Loop
Z=Mouse Zone
If Z=1
Read TILES$
TILES=Val(TILES$)
If TILES=320
Restore TIL
End If
TIL: Data " 4 "," 8 "," 20"," 40"," 80","160","320"
End If
Proc BUTTONPRINT
If Z=6
If MUZAK=-1
Track Stop
Else
If MUZAK=1 and MUSBANK=1
Track Play
End If
End If
End If
If Z=9
If OLD=-1
OLDTTIME=0
End If
Proc TILESDATA
Proc TIMECALC
Wait 25 : Screen 0 : Fade 1 : Wait 15
Reserve Zone
Screen Close 0
Rainbow Del 0
Pop Proc
End If
Goto HERE1
Wait Key
End Proc
Procedure BUTTONPRINT
Shared M
Screen 0
If Z=2 Then HORIZ=HORIZ*-1 : BUTTON=HORIZ
If Z=3 Then VERT=VERT*-1 : BUTTON=VERT
If Z=4 Then OLD=OLD*-1 : BUTTON=OLD
If Z=6 Then MUZAK=MUZAK*-1 : BUTTON=MUZAK
If Z=7 and MUZAK=1 Then MUZAKCHANGE=MUZAKCHANGE*-1 : BUTTON=MUZAKCHANGE
If Z=9 Then AHEAD=AHEAD*-1 : BUTTON=AHEAD
If Z=8
Inc PCOUNTER
If PCOUNTER=6
PCOUNTER=-1
End If
PCOUNT=PCOUNTER
If PCOUNTER=-1
PCOUNT=9999
End If
End If
If Z=5
Inc TIME
If TIME>2
TIME=-1
End If
BUTTON=TIME
End If
If Z>1 and Z<8
If BUTTON=1
BUTTON$="YES" : Paper 4
Else BUTTON$="OFF" : Paper 6
End If
End If
If Z=5
If BUTTON=0
BUTTON$="DEC" : Paper 0
End If
If BUTTON=1
BUTTON$="INC" : Paper 4
End If
If BUTTON=2
BUTTON$="CLK" : Paper 5
End If
End If
If Z=8
If PCOUNTER>-1 and PCOUNTER<6
Paper 5 : BUTTON$=Str$(PCOUNTER)+" "
If PCOUNTER=0
Paper 0
End If
End If
If PCOUNTER=-1
Paper 6 : BUTTON$="OFF"
End If
End If
If Z=9
If BUTTON=1
Paper 5 : BUTTON$=" PROCEED"
Else Paper 3 : BUTTON$=" HIT ME "
End If
End If
If Z=1
Paper 5
BUTTON$=Right$(TILES$,3)
End If
If Z>4
Locate 68,((Z-4)*4)+5
Else Locate 28,(Z*4)+5
End If
If Z=9
Locate 38,28
End If
Print Border$(BUTTON$,2)
If Z=6 and MUZAK=-1
MUZAKCHANGE=-1
BUTTON$="OFF"
Locate 68,((Z-3)*4)+5
Print Border$(BUTTON$,2)
End If
End Proc
Procedure TILESDATA
If TILES=4 Then XTILES=2 : YTILES=2 : XPIX=160*RES : YPIX=128
If TILES=8 Then XTILES=4 : YTILES=2 : XPIX=80*RES : YPIX=128
If TILES=20 Then XTILES=5 : YTILES=4 : XPIX=64*RES : YPIX=64
If TILES=40 Then XTILES=10 : YTILES=4 : XPIX=32*RES : YPIX=64
If TILES=80 Then XTILES=10 : YTILES=8 : XPIX=32*RES : YPIX=32
If TILES=160 Then XTILES=20 : YTILES=8 : XPIX=16*RES : YPIX=32
If TILES=320 Then XTILES=20 : YTILES=16 : XPIX=16*RES : YPIX=16
End Proc
Procedure CLOCK
If TIME=2 Then Goto HERE
If TIME=0
Dec TTIME : Inc OLDTTIME
If TTIME=0
WIN=1 : Pop Proc
End If
End If
If WIN=0 Then Inc SEC
If SEC>59 Then Inc WHOLEMIN : SEC=0
If WHOLEMIN>59 Then Inc HOUR : WHOLEMIN=0 : SEC=0
'
Dec FINSEC
If FINSEC<0 Then Dec FINWHOLEMIN : FINSEC=59
If FINWHOLEMIN<0 Then Dec FINHOUR : FINWHOLEMIN=59 : FINSEC=59
'
If TIME=0 Then GENERICHOUR=FINHOUR Else GENERICHOUR=HOUR
If TIME=0 Then GENERICWHOLEMIN=FINWHOLEMIN Else GENERICWHOLEMIN=WHOLEMIN
If TIME=0 Then GENERICSEC=FINSEC Else GENERICSEC=SEC
HOUR$=Right$(Str$(GENERICHOUR),Len(Str$(GENERICHOUR))-1) : If Len(HOUR$)<2 Then HOUR$="0"+HOUR$
WHOLEMIN$=Right$(Str$(GENERICWHOLEMIN),Len(Str$(GENERICWHOLEMIN))-1) : If Len(WHOLEMIN$)<2 Then WHOLEMIN$="0"+WHOLEMIN$
SEC$=Right$(Str$(GENERICSEC),Len(Str$(GENERICSEC))-1) : If Len(SEC$)<2 Then SEC$="0"+SEC$
Screen 2
Paper 0
If TIME>-1
Locate 12,0
TIME$=HOUR$+":"+WHOLEMIN$+":"+SEC$
Print TIME$;
End If
HERE:
If TIME=2
Proc _TIME$
Screen 2
Locate 12,0 : Print TIME$;
End If
Locate 24,0
Print "Move No.";MOVES;
If PCOUNT<6 and PCOUNT>-1
Pen 3
Locate 38,0
Print PCOUNT;
Pen 2
End If
Screen 0
If WIN=0 Then Every On
End Proc
Procedure _TIME$
'
' Call DOS function
T$=Space$(12)
Dreg(1)=Varptr(T$)
RIEN=Doscall(-192)
MN=Leek(Varptr(T$)+4)
SEC=Leek(Varptr(T$)+8)
'
' Minutes calculation
H=MN/60 : H$=Mid$(Str$(H),2) : If Len(H$)<2 : H$="0"+H$ : End If
M=MN mod 60 : M$=Mid$(Str$(M),2) : If Len(M$)<2 : M$="0"+M$ : End If
'
' Seconds calculation
S=SEC/50 : S$=Mid$(Str$(S),2) : If Len(S$)<2 : S$="0"+S$ : End If
'
' Final string
TIME$=H$+":"+M$+":"+S$
'
End Proc[TIME$]
Procedure ILLBEBACK
On Error Proc CORRECT
Rem Check o.k.
Every Off
STILLPRESSED:
If Key State(89) Then Goto STILLPRESSED
Clear Key
If MUZAK=-1 Then Bell
Screen 2
Colour 0,$B00
Get Block 321,0,0,640,8
FILESTOP:
Screen 2
Cls 1
Paper 1
Locate 0,0
Pen 3 : Print "Press:";
Pen 3 : Print " S"; : Pen 2 : Print " (SAVE Puzzle) ";
Pen 3 : Print " F10"; : Pen 2 : Print " (RETURN To Puzzle)";
THERE:
If Key State(89)
Cls
Locate 22,0 : Print "Returning to puzzle....";
Wait 75
If MUZAK=-1
Bell
End If
Colour 0,$337
Cls 0
Paper 0
Put Block 321,0,0
Screen 0
Limit Mouse X Hard(2),Y Hard(1) To X Hard((320*2)-2),Y Hard(255)
Every On
Pop Proc
End If
If Key State(33)
Cls
Locate 0,0
Paper 1
Print "Press any key to save the file...";
Wait Key
Cls
Clear Key
Screen Open 3,320,256,2,Lowres
Proc MOVE_SCREEN[3,0,-4]
Set Rainbow 0,1,280,"","","(9,1,15)(9,-1,15)"
Rainbow 0,0,40,280
FILESAVE:
Dir$="df0:"
F$=Fsel$("*.picpuz","","Save a Puzzle","Choose a name.")
If F$=""
Rainbow Del 0
Screen Close 3
Goto FILESTOP
End If
If Right$(F$,6)<>".picpuz"
Goto THERE2
End If
F$=F$+".picpuz"
THERE2:
If Exist(F$)=True
Kill F$
End If
Open Out 1,F$
Print #1,TILES
Print #1,TILES$
Print #1,MOVES
Print #1,PCOUNTER
Print #1,PCOUNT
Print #1,TIME
Print #1,OLDTTIME
Print #1,VERT
Print #1,HORIZ
Print #1,SEC
Print #1,WHOLEMIN
Print #1,HOUR
Print #1,PIC$
For A=1 To TILES
Print #1,PUZZLE(A)
Print #1,VFLIP(A)
Print #1,HFLIP(A)
Next
Close 1
Screen 2
Clear Key
Print "File Saved. Press any key to continue...";
Wait Key
Rainbow Del 0
Screen Close 3
Goto FILESTOP
End If
Goto THERE
End Proc
Procedure WHICHKEYS
Every Off
STILLPRESSED:
If Key State(69)=True Then Goto STILLPRESSED
Screen 2
If MUZAK=-1 Then Bell : Wait 10
Get Block 321,0,0,640,8
Do
Colour 0,$B00
Cls 0
Paper 0
Locate 0,0
Pen 3
Print " KEYS: "; : Pen 3 : Print "F1"; : Pen 2 : Print " (Finished)";
Pen 3 : Print " F5 "; : Pen 2 : Print "(Quit)";
Pen 3 : Print " SPACE"; : Pen 2 : Print " (H Flip)";
Pen 3 : Print " Right Mouse Button "; : Pen 2 : Print "(V Flip)";
For N=1 To 155
If Key State(69) Then N=175 : Goto HERE
Wait 1
Next
Cls
Locate 0,0
Pen 3 : Print " KEYS:";
Pen 3 : Print " Help"; : Pen 2 : Print " (View Pic.)";
Pen 3 : Print " F10"; : Pen 2 : Print " (Save Puzzle)";
Pen 3 : Print " M"; : Pen 2 : Print " (Music)";
Pen 3 : Print " Esc "; : Pen 2 : Print "(Return To PUZZLE)";
For N=1 To 155
If Key State(69) Then N=175 : Goto HERE
Wait 1
Next
If Key State(69) Then Exit
Cls
Locate 0,0
Pen 3 : Print " KEYS:";
Pen 3 : Print " Cursor Keys "; : Pen 2 : Print " (Vertically moves this information panel)";
For N=1 To 155
If Key State(69) Then N=175 : Goto HERE
Wait 1
Next
If Key State(69) Then Exit
Cls
Locate 0,0
Print " Press the "; : Pen 3 : Print "Esc"; : Pen 2 : Print " key before using any other key";
For N=1 To 155
If Key State(69) Then N=150 : Goto HERE
Wait 1
Next
If Key State(69) Then Exit
Loop
HERE:
STILLPRESSED1:
If Key State(69)=True Then Goto STILLPRESSED1
Colour 0,$337
Cls 0
Paper 0
Put Block 321,0,0
If MUZAK=-1 Then Bell
Screen 0
Limit Mouse X Hard(2),Y Hard(1) To X Hard((320*RES)-2),Y Hard(255)
Every On
End Proc
Procedure MUZAKPLAY
If MUZAKCHANGE=1 or MUZAK=1 and MUSBANK=0
Screen Open 3,640,256,2,Hires
Proc MOVE_SCREEN[3,0,-4]
Curs Off
Set Rainbow 0,1,280,"","","(9,1,15)(9,-1,15)"
Rainbow 0,0,40,280
On Error Proc CORRECT
MUSAKLOAD:
Clear Key
Dir$="sys:modules/"
F$=Fsel$("*.*","","Select NoiseTracker Module","to listen to")
If F$=""
Rainbow Del 0
Screen Close 3
If Length(7)=0
MUZAK=-1 : MUSBANK=0
Else MUZAK=1 : MUSBANK=1
End If
Pop Proc
End If
If Exist(F$)=False
Goto MUSAKLOAD
End If
If MUZAKCHANGE=1
MUZAKCHANGE=-1
End If
Rainbow Del 0
Wait 1
Palette $0,$FFF
Cls 0
Pen 1 : Paper 0
Locate 33,15
Print "Loading music..."
Track Load F$,7
MUSBANK=1
MUZAK=1
Track Loop On
Track Play
Screen Close 3
End If
End Proc
Procedure MUZAKMENU
Every Off
STILLPRESSED:
If Key State(69)=True Then Goto STILLPRESSED
Screen 2
Get Block 321,0,0,640,8
Colour 0,$B00
Cls 0
Paper 0
Locate 0,0
Pen 3 : Print " MUSIC MENU:";
Pen 3 : Print " C"; : Pen 2 : Print " (Change/Load Music)";
Pen 3 : Print " S"; : Pen 2 : Print " (Stop Music)";
Pen 3 : Print " P"; : Pen 2 : Print " (Play Music)";
If MUZAK=-1 Then Bell : Wait 10
Do
THERE:
Rem Change music
If Key State(51)
MUZAK=1
MUZAKCHANGE=1
Screen Hide 2
Proc MUZAKPLAY
Screen 2
Colour 0,$337
Put Block 321,0,0
Every On
Screen Show 2
MUZAKCHANGE=-1
Screen 0
Limit Mouse X Hard(2),Y Hard(1) To X Hard((320*RES)-2),Y Hard(255)
Pop Proc
End If
Rem stop music
If Key State(33)
Track Stop
MUZAK=-1
Colour 0,$337
Put Block 321,0,0
Bell
Every On
Pop Proc
Screen 0
Limit Mouse X Hard(2),Y Hard(1) To X Hard((320*RES)-2),Y Hard(255)
End If
Rem Play music
If Key State(25)
If Length(7)=0
Cls
Pen 2 : Print "No music loaded - Use (Change/Load Music) option";
Wait 100
Bell
End If
If MUZAK=-1
Track Play
MUZAK=1
End If
Colour 0,$337
Put Block 321,0,0
Every On
Screen 0
Limit Mouse X Hard(2),Y Hard(1) To X Hard((320*RES)-2),Y Hard(255)
Pop Proc
End If
Loop
End Proc
Procedure FILELOAD
On Error Proc CORRECT
Screen Open 3,320,256,2,Lowres
Curs Off
Proc MOVE_SCREEN[3,0,-4]
Set Rainbow 0,1,280,"","","(9,1,15)(9,-1,15)"
Rainbow 0,0,40,280
FILELOAD:
Clear Key
Dir$="sys:"
F$=Fsel$("*.picpuz","","Load a saved Puzzle","Select a '.picpuz file")
If F$=""
OLD=-1 : Pop Proc
End If
If Exist(F$)=False Then Goto FILELOAD
If Right$(F$,6)<>"picpuz" Then Goto FILELOAD
Rainbow Del 0
Screen Close 3
Open In 1,F$
Input #1,TILES
Input #1,TILES$
Input #1,MOVES
Input #1,PCOUNTER
Input #1,PCOUNT
Input #1,TIME
Input #1,OLDTTIME
Input #1,VERT
Input #1,HORIZ
Input #1,SEC
Input #1,WHOLEMIN
Input #1,HOUR
Input #1,PIC$
For A=1 To TILES
Input #1,PUZZLE(A)
Input #1,VFLIP(A)
Input #1,HFLIP(A)
Next
Close 1
Proc TILESDATA
Proc TIMECALC
OLD=1
End Proc
Procedure SIZE
Screen 1
SCRW=Screen Width
SCRH=Screen Height
COULS=Screen Colour
If SCRW>430
RESOLUTION=$8000
RES=2
Else
RESOLUTION=0
RES=1
End If
Proc TILESDATA
If SCRW=320 and SCRH=256 or SCRW=640 and SCRH=256 Then Goto HERE
Screen Open 4,640,256,4,Hires
Proc MOVE_SCREEN[4,0,-4]
Paper 0 : Pen 2 : Curs Off
Cls 0
Locate 15,15
Print "Please wait whilst picture size is adjusted....";
View
Screen Open 3,320*RES,256,COULS,RESOLUTION
Curs Off
Screen Hide 3
Proc MOVE_SCREEN[3,0,-4]
Get Palette 1 : Flash Off : Curs Off
Zoom 1,0,0,SCRW,SCRH To 3,0,0,320*RES,256
Screen Close 1
Screen Open 1,320*RES,256,COULS,RESOLUTION
Screen Hide 1
Proc MOVE_SCREEN[1,0,-4]
Get Palette 3
Flash Off : Curs Off
Screen Copy 3 To 1
Screen Close 3
Screen Close 4
HERE:
End Proc
Procedure CORRECT
Erase 7
Erase 1
F=Free
Every Off
Resume Next
End Proc
Procedure TIMECALC
If TIME<>0 Then Goto HERE
TTIME=0
If TILES=4 Then TTIME=2
If TILES=8 Then TTIME=5
If TILES=20 Then TTIME=25
If TILES=40 Then TTIME=75
If TILES=80 Then TTIME=150
If TILES=160 Then TTIME=540
If TILES=320 Then TTIME=1800
If VERT=1 Then TTIME=(TTIME*1.25)+1
If HORIZ=1 Then TTIME=(TTIME*1.25)+1
If PCOUNTER=5 Then TTIME=TTIME*1.05
If PCOUNTER=4 Then TTIME=TTIME*1.1
If PCOUNTER=3 Then TTIME=TTIME*1.2
If PCOUNTER=2 Then TTIME=TTIME*1.3
If PCOUNTER=1 Then TTIME=TTIME*1.5
If PCOUNTER=0 Then TTIME=TTIME*3
TTIME=TTIME-OLDTTIME
FINHOUR=TTIME/3600
FINWHOLEMIN=(TTIME-3600*FINHOUR)/60
FINSEC=TTIME-((FINHOUR*3600)+(FINWHOLEMIN*60))
HERE:
End Proc
Procedure OUTOFTIME
Hide On
Screen 0
Ink 1,1
Bar 68*RES,80 To 255*RES,155
Ink 2
Set Font 3
Gr Writing 0
C$="SORRY!"
If RES=1 Then Text 118*RES,110,C$
If RES=2 Then Text 142*RES,110,C$
C$="OUT OF TIME!!!"
If RES=1 Then Text 80*RES,140,C$
If RES=2 Then Text 122*RES,140,C$
Screen Swap : Wait Vbl
Screen Copy Physic To Logic
Screen Swap : Wait Vbl
Set Font 1
Gr Writing 1
If MUZAK=-1
For W=9 To 1 Step -1
Bell W
Wait 6
Next
Wait 1
End If
Do
If Mouse Click=1 Then Exit
Loop
If MUZAK=1 Then Track Play
Screen Close 1
Screen Close 2
Fade 1 : Wait 16
Screen Close 0
WIN=1
Clear Key
End Proc